home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / InputSprocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  28.2 KB  |  982 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        InputSprocket.h
  3.  
  4.      Contains:    Games Sprockets: InputSprocket interfaaces
  5.  
  6.      Version:    Technology:    Input Sprocket 1.2
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1996-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __INPUTSPROCKET__
  19. #define __INPUTSPROCKET__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __EVENTS__
  25. #include <Events.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=power
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50. #ifndef USE_OLD_INPUT_SPROCKET_LABELS
  51. #define USE_OLD_INPUT_SPROCKET_LABELS 1
  52. #endif  /*  ! defined(USE_OLD_INPUT_SPROCKET_LABELS)  */
  53.  
  54. #ifndef USE_OLD_ISPNEED_STRUCT
  55. #define USE_OLD_ISPNEED_STRUCT 1
  56. #endif  /*  ! defined(USE_OLD_ISPNEED_STRUCT)  */
  57.  
  58. #if TARGET_CPU_PPC
  59. /* ********************* data types ********************* */
  60. typedef struct OpaqueISpDeviceReference*  ISpDeviceReference;
  61. typedef struct OpaqueISpElementReference*  ISpElementReference;
  62. typedef struct OpaqueISpElementListReference*  ISpElementListReference;
  63. /* ISpDeviceClass is a general classs of device, example: keyboard, mouse, joystick */
  64. typedef OSType                             ISpDeviceClass;
  65. /* ISpDeviceIdentifier is a specific device,  example: standard 1-button mouse, 105key ext. kbd. */
  66. typedef OSType                             ISpDeviceIdentifier;
  67. typedef OSType                             ISpElementLabel;
  68. typedef OSType                             ISpElementKind;
  69.  
  70. /* *************** errors -30420 to -30439***************** */
  71.  
  72. enum {
  73.     kISpInternalErr                = -30420,
  74.     kISpSystemListErr            = -30421,
  75.     kISpBufferToSmallErr        = -30422,
  76.     kISpElementInListErr        = -30423,
  77.     kISpElementNotInListErr        = -30424,
  78.     kISpSystemInactiveErr        = -30425,
  79.     kISpDeviceInactiveErr        = -30426,
  80.     kISpSystemActiveErr            = -30427,
  81.     kISpDeviceActiveErr            = -30428,
  82.     kISpListBusyErr                = -30429
  83. };
  84.  
  85. /* *************** resources **************** */
  86.  
  87. enum {
  88.     kISpApplicationResourceType    = FOUR_CHAR_CODE('isap'),
  89.     kISpSetListResourceType        = FOUR_CHAR_CODE('setl'),
  90.     kISpSetDataResourceType        = FOUR_CHAR_CODE('setd')
  91. };
  92.  
  93.  
  94. struct ISpApplicationResourceStruct {
  95.     UInt32                             flags;
  96.     UInt32                             reserved1;
  97.     UInt32                             reserved2;
  98.     UInt32                             reserved3;
  99. };
  100. typedef struct ISpApplicationResourceStruct ISpApplicationResourceStruct;
  101.  
  102. enum {
  103.     kISpAppResFlag_UsesInputSprocket = 0x00000001,                /* true if the application uses InputSprocket*/
  104.     kISpAppResFlag_UsesISpInit    = 0x00000002                    /* true if the calls ISpInit (ie, uses the high level interface, calls ISpConfigure, has a needs list, etc...)*/
  105. };
  106.  
  107. /*
  108.  * ISpDeviceDefinition
  109.  *
  110.  * This structure provides all the available
  111.  * information for an input device within the system
  112.  *
  113.  */
  114.  
  115. struct ISpDeviceDefinition {
  116.     Str63                             deviceName;                    /* a human readable name of the device */
  117.     ISpDeviceClass                     theDeviceClass;                /* general classs of device example : keyboard, mouse, joystick */
  118.     ISpDeviceIdentifier             theDeviceIdentifier;        /* every distinguishable device should have an OSType */
  119.     UInt32                             permanentID;                /* a cross reboot id unique within that deviceType, 0 if not possible */
  120.     UInt32                             flags;                        /* status flags */
  121.     UInt32                             reserved1;
  122.     UInt32                             reserved2;
  123.     UInt32                             reserved3;
  124. };
  125. typedef struct ISpDeviceDefinition        ISpDeviceDefinition;
  126.  
  127. enum {
  128.     kISpDeviceFlag_HandleOwnEmulation = 1
  129. };
  130.  
  131. /*
  132.  * ISpElementEvent, ISpElementEventPtr
  133.  *
  134.  * This is the structure that event data is passed in.
  135.  *
  136.  */
  137.  
  138. struct ISpElementEvent {
  139.     AbsoluteTime                     when;                        /* this is absolute time on PCI or later, otherwise it is */
  140.                                                                 /* 0 for the hi 32 bits and TickCount for the low 32 bits */
  141.     ISpElementReference             element;                    /* a reference to the element that generated this event */
  142.     UInt32                             refCon;                        /* for application usage, 0 on the global list */
  143.     UInt32                             data;                        /* the data for this event */
  144. };
  145. typedef struct ISpElementEvent            ISpElementEvent;
  146. typedef ISpElementEvent *                ISpElementEventPtr;
  147. /*
  148.  * ISpElementInfo, ISpElementInfoPtr
  149.  *
  150.  * This is the generic definition of an element.
  151.  * Every element must contain this information.
  152.  *
  153.  */
  154.  
  155. struct ISpElementInfo {
  156.     ISpElementLabel                 theLabel;
  157.     ISpElementKind                     theKind;
  158.     Str63                             theString;
  159.     UInt32                             reserved1;
  160.     UInt32                             reserved2;
  161. };
  162. typedef struct ISpElementInfo            ISpElementInfo;
  163. typedef ISpElementInfo *                ISpElementInfoPtr;
  164.  
  165. typedef UInt32                             ISpNeedFlagBits;
  166. #if USE_OLD_ISPNEED_STRUCT
  167.  
  168. struct ISpNeed {
  169.     Str63                             name;
  170.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  171.     short                             reserved;
  172.     ISpElementKind                     theKind;
  173.     ISpElementLabel                 theLabel;
  174.     ISpNeedFlagBits                 flags;
  175.     UInt32                             reserved1;
  176.     UInt32                             reserved2;
  177.     UInt32                             reserved3;
  178. };
  179. typedef struct ISpNeed                    ISpNeed;
  180. #else
  181.  
  182. struct ISpNeed {
  183.     Str63                             name;                        /* human-readable string */
  184.     short                             iconSuiteResourceId;        /* resource id of the icon suite */
  185.     UInt8                             playerNum;                    /* used for multi-player support */
  186.     UInt8                             group;                        /* used to group related needs (eg, look left and look right button needs) */
  187.     ISpElementKind                     theKind;
  188.     ISpElementLabel                 theLabel;
  189.     ISpNeedFlagBits                 flags;
  190.     UInt32                             reserved1;
  191.     UInt32                             reserved2;
  192.     UInt32                             reserved3;
  193. };
  194. typedef struct ISpNeed                    ISpNeed;
  195. #endif  /* USE_OLD_ISPNEED_STRUCT */
  196.  
  197.  
  198. enum {
  199.     kISpNeedFlag_NoMultiConfig    = 0x00000001,                    /* once this need is autoconfigured to one device dont autoconfigure to anything else*/
  200.     kISpNeedFlag_Utility        = 0x00000002,                    /* this need is a utility function (like show framerate) which would not typically be assigned to anything but the keyboard*/
  201.     kISpNeedFlag_PolledOnly        = 0x00000004,
  202.     kISpNeedFlag_EventsOnly        = 0x00000008,                    /* *** kISpElementKind specific flags ****/
  203.                                                                 /* these are flags specific to kISpElementKind_Button*/
  204.     kISpNeedFlag_Button_AlreadyAxis = 0x10000000,                /* there is a axis version of this button need*/
  205.     kISpNeedFlag_Button_ClickToggles = 0x20000000,
  206.     kISpNeedFlag_Button_ActiveWhenDown = 0x40000000,            /* these are flags specific to kISpElementKind_DPad*/
  207.                                                                 /* these are flags specific to kISpElementKind_Axis*/
  208.     kISpNeedFlag_Axis_AlreadyButton = 0x10000000,                /* there is a button version of this axis need*/
  209.     kISpNeedFlag_Axis_Asymetric    = 0x20000000,                    /* this axis need is asymetric    */
  210.                                                                 /* these are flags specific to kISpElementKind_Delta*/
  211.     kISpNeedFlag_Delta_AlreadyAxis = 0x10000000                    /* there is a axis version of this delta need*/
  212. };
  213.  
  214. /*
  215.  *
  216.  * These are the current built values for ISpDeviceClass
  217.  *
  218.  */
  219.  
  220. enum {
  221.     kISpDeviceClass_SpeechRecognition = FOUR_CHAR_CODE('talk'),
  222.     kISpDeviceClass_Mouse        = FOUR_CHAR_CODE('mous'),
  223.     kISpDeviceClass_Keyboard    = FOUR_CHAR_CODE('keyd'),
  224.     kISpDeviceClass_Joystick    = FOUR_CHAR_CODE('joys'),
  225.     kISpDeviceClass_Wheel        = FOUR_CHAR_CODE('whel'),
  226.     kISpDeviceClass_Pedals        = FOUR_CHAR_CODE('pedl'),
  227.     kISpDeviceClass_Levers        = FOUR_CHAR_CODE('levr'),
  228.     kISpDeviceClass_Tickle        = FOUR_CHAR_CODE('tckl')        /* a device of this class requires ISpTickle*/
  229. };
  230.  
  231. /*
  232.  * These are the current built in ISpElementKind's
  233.  * 
  234.  * These are all OSTypes.
  235.  *
  236.  */
  237.  
  238. enum {
  239.     kISpElementKind_Button        = FOUR_CHAR_CODE('butn'),
  240.     kISpElementKind_DPad        = FOUR_CHAR_CODE('dpad'),
  241.     kISpElementKind_Axis        = FOUR_CHAR_CODE('axis'),
  242.     kISpElementKind_Delta        = FOUR_CHAR_CODE('dlta'),
  243.     kISpElementKind_Movement    = FOUR_CHAR_CODE('move'),
  244.     kISpElementKind_Virtual        = FOUR_CHAR_CODE('virt')
  245. };
  246.  
  247.  
  248. /*
  249.  *
  250.  * These are the current built in ISpElementLabel's
  251.  *
  252.  * These are all OSTypes.
  253.  *
  254.  */
  255. #if USE_OLD_INPUT_SPROCKET_LABELS
  256.  
  257. enum {
  258.                                                                 /* axis */
  259.     kISpElementLabel_XAxis        = FOUR_CHAR_CODE('xaxi'),
  260.     kISpElementLabel_YAxis        = FOUR_CHAR_CODE('yaxi'),
  261.     kISpElementLabel_ZAxis        = FOUR_CHAR_CODE('zaxi'),
  262.     kISpElementLabel_Rx            = FOUR_CHAR_CODE('rxax'),
  263.     kISpElementLabel_Ry            = FOUR_CHAR_CODE('ryax'),
  264.     kISpElementLabel_Rz            = FOUR_CHAR_CODE('rzax'),
  265.     kISpElementLabel_Gas        = FOUR_CHAR_CODE('gasp'),
  266.     kISpElementLabel_Brake        = FOUR_CHAR_CODE('brak'),
  267.     kISpElementLabel_Clutch        = FOUR_CHAR_CODE('cltc'),
  268.     kISpElementLabel_Throttle    = FOUR_CHAR_CODE('thrt'),
  269.     kISpElementLabel_Trim        = FOUR_CHAR_CODE('trim'),        /* direction pad */
  270.     kISpElementLabel_POVHat        = FOUR_CHAR_CODE('povh'),
  271.     kISpElementLabel_PadMove    = FOUR_CHAR_CODE('move'),        /* buttons */
  272.     kISpElementLabel_Fire        = FOUR_CHAR_CODE('fire'),
  273.     kISpElementLabel_Start        = FOUR_CHAR_CODE('strt'),
  274.     kISpElementLabel_Select        = FOUR_CHAR_CODE('optn')
  275. };
  276.  
  277. #endif  /* USE_OLD_INPUT_SPROCKET_LABELS */
  278.  
  279.  
  280. enum {
  281.                                                                 /* generic */
  282.     kISpElementLabel_None        = FOUR_CHAR_CODE('none'),        /* axis */
  283.     kISpElementLabel_Axis_XAxis    = FOUR_CHAR_CODE('xaxi'),
  284.     kISpElementLabel_Axis_YAxis    = FOUR_CHAR_CODE('yaxi'),
  285.     kISpElementLabel_Axis_ZAxis    = FOUR_CHAR_CODE('zaxi'),
  286.     kISpElementLabel_Axis_Rx    = FOUR_CHAR_CODE('rxax'),
  287.     kISpElementLabel_Axis_Ry    = FOUR_CHAR_CODE('ryax'),
  288.     kISpElementLabel_Axis_Rz    = FOUR_CHAR_CODE('rzax'),
  289.     kISpElementLabel_Axis_Roll    = kISpElementLabel_Axis_Rz,
  290.     kISpElementLabel_Axis_Pitch    = kISpElementLabel_Axis_Rx,
  291.     kISpElementLabel_Axis_Yaw    = kISpElementLabel_Axis_Ry,
  292.     kISpElementLabel_Axis_RollTrim = FOUR_CHAR_CODE('rxtm'),
  293.     kISpElementLabel_Axis_PitchTrim = FOUR_CHAR_CODE('trim'),
  294.     kISpElementLabel_Axis_YawTrim = FOUR_CHAR_CODE('rytm'),
  295.     kISpElementLabel_Axis_Gas    = FOUR_CHAR_CODE('gasp'),
  296.     kISpElementLabel_Axis_Brake    = FOUR_CHAR_CODE('brak'),
  297.     kISpElementLabel_Axis_Clutch = FOUR_CHAR_CODE('cltc'),
  298.     kISpElementLabel_Axis_Throttle = FOUR_CHAR_CODE('thrt'),
  299.     kISpElementLabel_Axis_Trim    = kISpElementLabel_Axis_PitchTrim,
  300.     kISpElementLabel_Axis_Rudder = FOUR_CHAR_CODE('rudd'),        /* delta */
  301.     kISpElementLabel_Delta_X    = FOUR_CHAR_CODE('xdlt'),
  302.     kISpElementLabel_Delta_Y    = FOUR_CHAR_CODE('ydlt'),
  303.     kISpElementLabel_Delta_Z    = FOUR_CHAR_CODE('zdlt'),
  304.     kISpElementLabel_Delta_Rx    = FOUR_CHAR_CODE('rxdl'),
  305.     kISpElementLabel_Delta_Ry    = FOUR_CHAR_CODE('rydl'),
  306.     kISpElementLabel_Delta_Rz    = FOUR_CHAR_CODE('rzdl'),
  307.     kISpElementLabel_Delta_Roll    = kISpElementLabel_Delta_Rz,
  308.     kISpElementLabel_Delta_Pitch = kISpElementLabel_Delta_Rx,
  309.     kISpElementLabel_Delta_Yaw    = kISpElementLabel_Delta_Ry,    /* direction pad */
  310.     kISpElementLabel_Pad_POV    = FOUR_CHAR_CODE('povh'),
  311.     kISpElementLabel_Pad_Move    = FOUR_CHAR_CODE('move'),        /* buttons */
  312.     kISpElementLabel_Btn_Fire    = FOUR_CHAR_CODE('fire'),
  313.     kISpElementLabel_Btn_SecondaryFire = FOUR_CHAR_CODE('sfir'),
  314.     kISpElementLabel_Btn_Jump    = FOUR_CHAR_CODE('jump'),
  315.     kISpElementLabel_Btn_PauseResume = FOUR_CHAR_CODE('strt'),    /* kISpElementLabel_Btn_PauseResume automatically binds to escape */
  316.     kISpElementLabel_Btn_Select    = FOUR_CHAR_CODE('optn'),
  317.     kISpElementLabel_Btn_SlideLeft = FOUR_CHAR_CODE('blft'),
  318.     kISpElementLabel_Btn_SlideRight = FOUR_CHAR_CODE('brgt'),
  319.     kISpElementLabel_Btn_MoveForward = FOUR_CHAR_CODE('btmf'),
  320.     kISpElementLabel_Btn_MoveBackward = FOUR_CHAR_CODE('btmb'),
  321.     kISpElementLabel_Btn_TurnLeft = FOUR_CHAR_CODE('bttl'),
  322.     kISpElementLabel_Btn_TurnRight = FOUR_CHAR_CODE('bttr'),
  323.     kISpElementLabel_Btn_LookLeft = FOUR_CHAR_CODE('btll'),
  324.     kISpElementLabel_Btn_LookRight = FOUR_CHAR_CODE('btlr'),
  325.     kISpElementLabel_Btn_LookUp    = FOUR_CHAR_CODE('btlu'),
  326.     kISpElementLabel_Btn_LookDown = FOUR_CHAR_CODE('btld'),
  327.     kISpElementLabel_Btn_Next    = FOUR_CHAR_CODE('btnx'),
  328.     kISpElementLabel_Btn_Previous = FOUR_CHAR_CODE('btpv'),
  329.     kISpElementLabel_Btn_SideStep = FOUR_CHAR_CODE('side'),
  330.     kISpElementLabel_Btn_Run    = FOUR_CHAR_CODE('quik'),
  331.     kISpElementLabel_Btn_Look    = FOUR_CHAR_CODE('blok')
  332. };
  333.  
  334. /*
  335.  *
  336.  * direction pad data & configuration information
  337.  *
  338.  */
  339.  
  340. typedef UInt32                             ISpDPadData;
  341.  
  342. enum {
  343.     kISpPadIdle                    = 0,
  344.     kISpPadLeft                    = 1,
  345.     kISpPadUpLeft                = 2,
  346.     kISpPadUp                    = 3,
  347.     kISpPadUpRight                = 4,
  348.     kISpPadRight                = 5,
  349.     kISpPadDownRight            = 6,
  350.     kISpPadDown                    = 7,
  351.     kISpPadDownLeft                = 8
  352. };
  353.  
  354.  
  355. struct ISpDPadConfigurationInfo {
  356.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of direction pads */
  357.     Boolean                         fourWayPad;                    /* true if this pad can only produce idle + four directions */
  358. };
  359. typedef struct ISpDPadConfigurationInfo    ISpDPadConfigurationInfo;
  360. /*
  361.  *
  362.  * button data & configuration information
  363.  *
  364.  */
  365.  
  366. typedef UInt32                             ISpButtonData;
  367.  
  368. enum {
  369.     kISpButtonUp                = 0,
  370.     kISpButtonDown                = 1
  371. };
  372.  
  373.  
  374. struct ISpButtonConfigurationInfo {
  375.     UInt32                             id;                            /* ordering 1..n, 0 = no relavent ordering of buttons */
  376. };
  377. typedef struct ISpButtonConfigurationInfo ISpButtonConfigurationInfo;
  378. /*
  379.  *
  380.  * axis data & configuration information 
  381.  *
  382.  */
  383.  
  384. typedef UInt32                             ISpAxisData;
  385.  
  386. #define    kISpAxisMinimum  0x00000000U
  387. #define    kISpAxisMiddle   0x7FFFFFFFU
  388. #define    kISpAxisMaximum  0xFFFFFFFFU
  389.  
  390.  
  391. struct ISpAxisConfigurationInfo {
  392.     Boolean                         symetricAxis;                /* axis is symetric, i.e. a joystick is symetric and a gas pedal is not */
  393. };
  394. typedef struct ISpAxisConfigurationInfo    ISpAxisConfigurationInfo;
  395.  
  396. typedef Fixed                             ISpDeltaData;
  397.  
  398. struct ISpDeltaConfigurationInfo {
  399.     UInt32                             reserved1;
  400.     UInt32                             reserved2;
  401. };
  402. typedef struct ISpDeltaConfigurationInfo ISpDeltaConfigurationInfo;
  403.  
  404. struct ISpMovementData {
  405.     ISpAxisData                     xAxis;
  406.     ISpAxisData                     yAxis;
  407.     ISpDPadData                     direction;                    /* ISpDPadData version of the movement */
  408. };
  409. typedef struct ISpMovementData            ISpMovementData;
  410.  
  411. enum {
  412.     kISpVirtualElementFlag_UseTempMem = 1
  413. };
  414.  
  415.  
  416. enum {
  417.     kISpElementListFlag_UseTempMem = 1
  418. };
  419.  
  420.  
  421. enum {
  422.     kISpFirstIconSuite            = 30000,
  423.     kISpLastIconSuite            = 30100,
  424.     kISpNoneIconSuite            = 30000
  425. };
  426.  
  427. /* ********************* user level functions ********************* */
  428.  
  429.  
  430. /*
  431.  *
  432.  * startup / shutdown
  433.  *
  434.  */
  435. EXTERN_API_C( OSStatus )
  436. ISpStartup                        (void);
  437.  
  438. /* 1.1 or later*/
  439. EXTERN_API_C( OSStatus )
  440. ISpShutdown                        (void);
  441.  
  442. /* 1.1 or later*/
  443. /*
  444.  *
  445.  * polling
  446.  *
  447.  */
  448. EXTERN_API_C( OSStatus )
  449. ISpTickle                        (void);
  450.  
  451. /* 1.1 or later*/
  452. /********** user interface functions **********/
  453.  
  454. EXTERN_API_C( NumVersion )
  455. ISpGetVersion                    (void);
  456.  
  457. /*
  458.  *
  459.  * ISpElement_NewVirtual(ISpElementReference *outElement);
  460.  *
  461.  */
  462. EXTERN_API_C( OSStatus )
  463. ISpElement_NewVirtual            (UInt32                 dataSize,
  464.                                  ISpElementReference *    outElement,
  465.                                  UInt32                 flags);
  466.  
  467. /*
  468.  *
  469.  * ISpElement_NewVirtualFromNeeds(UInt32 count, ISpNeeds *needs, ISpElementReference *outElements);
  470.  *
  471.  */
  472. EXTERN_API_C( OSStatus )
  473. ISpElement_NewVirtualFromNeeds    (UInt32                 count,
  474.                                  ISpNeed *                needs,
  475.                                  ISpElementReference *    outElements,
  476.                                  UInt32                 flags);
  477.  
  478. /*
  479.  *
  480.  * ISpElement_DisposeVirtual(inElement);
  481.  *
  482.  */
  483. EXTERN_API_C( OSStatus )
  484. ISpElement_DisposeVirtual        (UInt32                 count,
  485.                                  ISpElementReference *    inElements);
  486.  
  487. /*
  488.  * ISpInit
  489.  *
  490.  */
  491. EXTERN_API_C( OSStatus )
  492. ISpInit                            (UInt32                 count,
  493.                                  ISpNeed *                needs,
  494.                                  ISpElementReference *    inReferences,
  495.                                  OSType                 appCreatorCode,
  496.                                  OSType                 subCreatorCode,
  497.                                  UInt32                 flags,
  498.                                  short                     setListResourceId,
  499.                                  UInt32                 reserved);
  500.  
  501.  
  502. /*
  503.  * ISpConfigure
  504.  *
  505.  */
  506. typedef CALLBACK_API_C( Boolean , ISpEventProcPtr )(EventRecord *inEvent);
  507. EXTERN_API_C( OSStatus )
  508. ISpConfigure                    (ISpEventProcPtr         inEventProcPtr);
  509.  
  510. /*
  511.  *
  512.  * ISpStop
  513.  *
  514.  */
  515. EXTERN_API_C( OSStatus )
  516. ISpStop                            (void);
  517.  
  518. /*
  519.  *
  520.  * ISpSuspend, ISpResume
  521.  *
  522.  * ISpSuspend turns all devices off and allocates memory so that the state may be later resumed.
  523.  * ISpResume resumes to the previous state of the system after a suspend call.
  524.  * 
  525.  * Return Codes
  526.  * memFullErr
  527.  *
  528.  */
  529. EXTERN_API_C( OSStatus )
  530. ISpSuspend                        (void);
  531.  
  532. EXTERN_API_C( OSStatus )
  533. ISpResume                        (void);
  534.  
  535. /*
  536.  * ISpDevices_Extract, ISpDevices_ExtractByClass, ISpDevices_ExtractByIdentifier
  537.  *
  538.  * These will extract as many device references from the system wide list as will fit in your buffer.  
  539.  *
  540.  * inBufferCount - the size of your buffer (in units of sizeof(ISpDeviceReference)) this may be zero
  541.  * buffer - a pointer to your buffer
  542.  * outCount - contains the number of devices in the system
  543.  *
  544.  * ISpDevices_ExtractByClass extracts and counts devices of the specified ISpDeviceClass
  545.  * ISpDevices_ExtractByIdentifier extracts and counts devices of the specified ISpDeviceIdentifier
  546.  *
  547.  * Return Codes
  548.  * paramErr
  549.  *
  550.  */
  551. EXTERN_API_C( OSStatus )
  552. ISpDevices_Extract                (UInt32                 inBufferCount,
  553.                                  UInt32 *                outCount,
  554.                                  ISpDeviceReference *    buffer);
  555.  
  556. EXTERN_API_C( OSStatus )
  557. ISpDevices_ExtractByClass        (ISpDeviceClass         inClass,
  558.                                  UInt32                 inBufferCount,
  559.                                  UInt32 *                outCount,
  560.                                  ISpDeviceReference *    buffer);
  561.  
  562. EXTERN_API_C( OSStatus )
  563. ISpDevices_ExtractByIdentifier    (ISpDeviceIdentifier     inIdentifier,
  564.                                  UInt32                 inBufferCount,
  565.                                  UInt32 *                outCount,
  566.                                  ISpDeviceReference *    buffer);
  567.  
  568.  
  569. /*
  570.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass, ISpDevices_Activate, ISpDevices_Deactivate, ISpDevice_IsActive
  571.  *
  572.  * ISpDevices_Activate, ISpDevices_Deactivate
  573.  *
  574.  * This will activate/deactivate a block of devices.
  575.  * inDeviceCount - the number of devices to activate / deactivate
  576.  * inDevicesToActivate/inDevicesToDeactivate - a pointer to a block of memory contains the devices references
  577.  *
  578.  * ISpDevices_ActivateClass, ISpDevices_DeactivateClass
  579.  * inClass - the class of devices to activate or deactivate
  580.  *
  581.  * ISpDevice_IsActive
  582.  * inDevice - the device reference that you wish to 
  583.  * outIsActive - a boolean value that is true when the device is active
  584.  *
  585.  * Return Codes
  586.  * paramErr
  587.  *
  588.  */
  589. EXTERN_API_C( OSStatus )
  590. ISpDevices_ActivateClass        (ISpDeviceClass         inClass);
  591.  
  592. /* 1.1 or later*/
  593. EXTERN_API_C( OSStatus )
  594. ISpDevices_DeactivateClass        (ISpDeviceClass         inClass);
  595.  
  596. /* 1.1 or later*/
  597. EXTERN_API_C( OSStatus )
  598. ISpDevices_Activate                (UInt32                 inDeviceCount,
  599.                                  ISpDeviceReference *    inDevicesToActivate);
  600.  
  601. EXTERN_API_C( OSStatus )
  602. ISpDevices_Deactivate            (UInt32                 inDeviceCount,
  603.                                  ISpDeviceReference *    inDevicesToDeactivate);
  604.  
  605. EXTERN_API_C( OSStatus )
  606. ISpDevice_IsActive                (ISpDeviceReference     inDevice,
  607.                                  Boolean *                outIsActive);
  608.  
  609. /*
  610.  * ISpDevice_GetDefinition
  611.  *
  612.  *
  613.  * inDevice - the device you want to get the definition for
  614.  * inBuflen - the size of the structure (sizeof(ISpDeviceDefinition))
  615.  * outStruct - a pointer to where you want the structure copied
  616.  *
  617.  * Return Codes
  618.  * paramErr
  619.  *
  620.  */
  621. EXTERN_API_C( OSStatus )
  622. ISpDevice_GetDefinition            (ISpDeviceReference     inDevice,
  623.                                  UInt32                 inBuflen,
  624.                                  ISpDeviceDefinition *    outStruct);
  625.  
  626.  
  627. /*
  628.  *
  629.  * ISpDevice_GetElementList
  630.  *
  631.  * inDevice - the device whose element list you wish to get
  632.  * outElementList - a pointer to where you want a reference to that list stored
  633.  *
  634.  * Return Codes
  635.  * paramErr
  636.  *
  637.  */
  638. EXTERN_API_C( OSStatus )
  639. ISpDevice_GetElementList        (ISpDeviceReference     inDevice,
  640.                                  ISpElementListReference * outElementList);
  641.  
  642. /*
  643.  *
  644.  * takes an ISpElementReference and returns the group that it is in or 0 if there is
  645.  * no group
  646.  *
  647.  * Return Codes
  648.  * paramErr
  649.  *
  650.  */
  651. EXTERN_API_C( OSStatus )
  652. ISpElement_GetGroup                (ISpElementReference     inElement,
  653.                                  UInt32 *                outGroup);
  654.  
  655. /*
  656.  *
  657.  * takes an ISpElementReference and returns the device that the element belongs 
  658.  * to.
  659.  *
  660.  * Return Codes
  661.  * paramErr if inElement is 0 or outDevice is nil
  662.  *
  663.  */
  664. EXTERN_API_C( OSStatus )
  665. ISpElement_GetDevice            (ISpElementReference     inElement,
  666.                                  ISpDeviceReference *    outDevice);
  667.  
  668. /*
  669.  *
  670.  * takes an ISpElementReference and gives the ISpElementInfo for that Element.  This is the
  671.  * the set of standard information.  You get ISpElementKind specific information
  672.  * through ISpElement_GetConfigurationInfo.
  673.  *
  674.  * Return Codes
  675.  * paramErr if inElement is 0 or outInfo is nil
  676.  *
  677.  */
  678. EXTERN_API_C( OSStatus )
  679. ISpElement_GetInfo                (ISpElementReference     inElement,
  680.                                  ISpElementInfoPtr         outInfo);
  681.  
  682. /*
  683.  *
  684.  *         
  685.  *
  686.  * takes an ISpElementReference and gives the ISpElementKind specific configuration information
  687.  * 
  688.  * if buflen is not long enough to hold the information ISpElement_GetConfigurationInfo will
  689.  * copy buflen bytes of the data into the block of memory pointed to by configInfo and
  690.  * will return something error.
  691.  *
  692.  * Return Codes
  693.  * paramErr if inElement or configInfo is nil
  694.  *
  695.  */
  696. EXTERN_API_C( OSStatus )
  697. ISpElement_GetConfigurationInfo    (ISpElementReference     inElement,
  698.                                  UInt32                 buflen,
  699.                                  void *                    configInfo);
  700.  
  701. /*
  702.  *
  703.  * ISpElement_GetSimpleState
  704.  *
  705.  * Takes an ISpElementReference and returns the current state of that element.  This is a 
  706.  * specialized version of ISpElement_GetComplexState that is only appropriate for elements
  707.  * whose data fits in a signed 32 bit integer.
  708.  *
  709.  *
  710.  *
  711.  * Return Codes
  712.  * paramErr if inElement is 0 or state is nil
  713.  *
  714.  */
  715. EXTERN_API_C( OSStatus )
  716. ISpElement_GetSimpleState        (ISpElementReference     inElement,
  717.                                  UInt32 *                state);
  718.  
  719. /*
  720.  *
  721.  * ISpElement_GetComplexState
  722.  *
  723.  * Takes an ISpElementReference and returns the current state of that element.  
  724.  * Will copy up to buflen bytes of the current state of the device into
  725.  * state.
  726.  *
  727.  *
  728.  * Return Codes
  729.  * paramErr if inElement is 0 or state is nil
  730.  *
  731.  */
  732. EXTERN_API_C( OSStatus )
  733. ISpElement_GetComplexState        (ISpElementReference     inElement,
  734.                                  UInt32                 buflen,
  735.                                  void *                    state);
  736.  
  737.  
  738. /*
  739.  * ISpElement_GetNextEvent
  740.  *
  741.  * It takes in an element  reference and the buffer size of the ISpElementEventPtr
  742.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  743.  * was not enough space to fill in the whole event structure that event will be
  744.  * dequed, as much of the event as will fit in the buffer will by copied and
  745.  * ISpElement_GetNextEvent will return an error.
  746.  *
  747.  * Return Codes
  748.  * paramErr
  749.  *
  750.  */
  751. EXTERN_API_C( OSStatus )
  752. ISpElement_GetNextEvent            (ISpElementReference     inElement,
  753.                                  UInt32                 bufSize,
  754.                                  ISpElementEventPtr     event,
  755.                                  Boolean *                wasEvent);
  756.  
  757. /*
  758.  *
  759.  * ISpElement_Flush
  760.  *
  761.  * It takes an ISpElementReference and flushes all the events on that element.  All it guaruntees is
  762.  * that any events that made it to this layer before the time of the flush call will be flushed and
  763.  * it will not flush any events that make it to this layer after the time when the call has returned.
  764.  * What happens to events that occur during the flush is undefined.
  765.  *
  766.  *
  767.  * Return Codes
  768.  * paramErr
  769.  *
  770.  */
  771. EXTERN_API_C( OSStatus )
  772. ISpElement_Flush                (ISpElementReference     inElement);
  773.  
  774.  
  775.  
  776. /*
  777.  * ISpElementList_New
  778.  *
  779.  * Creates a new element list and returns it in outElementList.  In count specifies 
  780.  * the number of element references in the list pointed to by inElements.  If inCount
  781.  * is non zero the list is created with inCount elements in at as specified by the 
  782.  * inElements parameter.  Otherwise the list is created empty.
  783.  *
  784.  *
  785.  * Return Codes
  786.  * out of memory - If it failed to allocate the list because it was out of memory
  787.                    it will also set outElementList to 0
  788.  * paramErr if outElementList was nil
  789.  *
  790.  *
  791.  * Special Concerns
  792.  *
  793.  * interrupt unsafe
  794.  *
  795.  */
  796. EXTERN_API_C( OSStatus )
  797. ISpElementList_New                (UInt32                 inCount,
  798.                                  ISpElementReference *    inElements,
  799.                                  ISpElementListReference * outElementList,
  800.                                  UInt32                 flags);
  801.  
  802. /*
  803.  * ISpElementList_Dispose
  804.  *
  805.  * Deletes an already existing memory list.  
  806.  *
  807.  *
  808.  * Return Codes
  809.  * paramErr if inElementList was 0
  810.  *
  811.  *
  812.  * Special Concerns
  813.  *
  814.  * interrupt unsafe
  815.  *
  816.  */
  817. EXTERN_API_C( OSStatus )
  818. ISpElementList_Dispose            (ISpElementListReference  inElementList);
  819.  
  820. /*
  821.  * ISpGetGlobalElementList
  822.  *
  823.  * returns the global element list
  824.  *
  825.  * Return Codes
  826.  * paramErr if outElementList is nil
  827.  *
  828.  */
  829. EXTERN_API_C( OSStatus )
  830. ISpGetGlobalElementList            (ISpElementListReference * outElementList);
  831.  
  832. /*
  833.  * ISpElementList_AddElement
  834.  *
  835.  * adds an element to the element list
  836.  *
  837.  * Return Codes
  838.  * paramErr if inElementList is 0 or newElement is 0
  839.  * memory error if the system is unable to allocate enough memory
  840.  *
  841.  * Special Concerns
  842.  * interrupt Unsafe
  843.  * 
  844.  */
  845. EXTERN_API_C( OSStatus )
  846. ISpElementList_AddElements        (ISpElementListReference  inElementList,
  847.                                  UInt32                 refCon,
  848.                                  UInt32                 count,
  849.                                  ISpElementReference *    newElements);
  850.  
  851. /*
  852.  * ISpElementList_RemoveElement
  853.  *
  854.  * removes the specified element from the element list
  855.  *
  856.  * Return Codes
  857.  * paramErr if inElementList is 0 or oldElement is 0
  858.  * memory error if the system is unable to allocate enough memory
  859.  *
  860.  * Special Concerns
  861.  * interrupt Unsafe
  862.  * 
  863.  */
  864. EXTERN_API_C( OSStatus )
  865. ISpElementList_RemoveElements    (ISpElementListReference  inElementList,
  866.                                  UInt32                 count,
  867.                                  ISpElementReference *    oldElement);
  868.  
  869. /*
  870.  * ISpElementList_Extract
  871.  *
  872.  * ISpElementList_Extract will extract as many of the elements from an element list as possible.  You pass
  873.  * in an element list, a pointer to an array of element references and the number of elements in that array.
  874.  * It will return how many items are in the element list in the outCount parameter and copy the minimum of 
  875.  * that number and the size of the array into the buffer.
  876.  *
  877.  * ByKind and ByLabel are the same except that they will only count and copy element references to elements
  878.  * that have the specified kind and label.
  879.  *
  880.  * Return Codes
  881.  * paramErr
  882.  *
  883.  */
  884. EXTERN_API_C( OSStatus )
  885. ISpElementList_Extract            (ISpElementListReference  inElementList,
  886.                                  UInt32                 inBufferCount,
  887.                                  UInt32 *                outCount,
  888.                                  ISpElementReference *    buffer);
  889.  
  890. EXTERN_API_C( OSStatus )
  891. ISpElementList_ExtractByKind    (ISpElementListReference  inElementList,
  892.                                  ISpElementKind         inKind,
  893.                                  UInt32                 inBufferCount,
  894.                                  UInt32 *                outCount,
  895.                                  ISpElementReference *    buffer);
  896.  
  897. EXTERN_API_C( OSStatus )
  898. ISpElementList_ExtractByLabel    (ISpElementListReference  inElementList,
  899.                                  ISpElementLabel         inLabel,
  900.                                  UInt32                 inBufferCount,
  901.                                  UInt32 *                outCount,
  902.                                  ISpElementReference *    buffer);
  903.  
  904. /*
  905.  * ISpElementList_GetNextEvent
  906.  *
  907.  * It takes in an element list reference and the buffer size of the ISpElementEventPtr
  908.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  909.  * was not enough space to fill in the whole event structure that event will be
  910.  * dequed, as much of the event as will fit in the buffer will by copied and
  911.  * ISpElementList_GetNextEvent will return an error.
  912.  *
  913.  * Return Codes
  914.  * paramErr
  915.  *
  916.  */
  917. EXTERN_API_C( OSStatus )
  918. ISpElementList_GetNextEvent        (ISpElementListReference  inElementList,
  919.                                  UInt32                 bufSize,
  920.                                  ISpElementEventPtr     event,
  921.                                  Boolean *                wasEvent);
  922.  
  923. /*
  924.  *
  925.  * ISpElementList_Flush
  926.  *
  927.  * It takes an ISpElementListReference and flushes all the events on that list.  All it guaruntees is
  928.  * that any events that made it to this layer before the time of the flush call will be flushed and
  929.  * it will not flush any events that make it to this layer after the time when the call has returned.
  930.  * What happens to events that occur during the flush is undefined.
  931.  *
  932.  *
  933.  * Return Codes
  934.  * paramErr
  935.  *
  936.  */
  937. EXTERN_API_C( OSStatus )
  938. ISpElementList_Flush            (ISpElementListReference  inElementList);
  939.  
  940. /*
  941.  *
  942.  * ISpTimeToMicroseconds
  943.  *
  944.  *
  945.  * This function takes time from an input sprocket event and converts it
  946.  * into microseconds. (Version 1.2 or later of InputSprocket.)
  947.  *
  948.  *
  949.  * Return Codes
  950.  * paramErr
  951.  *
  952.  */
  953. EXTERN_API_C( OSStatus )
  954. ISpTimeToMicroseconds            (const AbsoluteTime *    inTime,
  955.                                  UnsignedWide *            outMicroseconds);
  956.  
  957.  
  958. #endif  /* TARGET_CPU_PPC */
  959.  
  960.  
  961.  
  962. #if PRAGMA_STRUCT_ALIGN
  963.     #pragma options align=reset
  964. #elif PRAGMA_STRUCT_PACKPUSH
  965.     #pragma pack(pop)
  966. #elif PRAGMA_STRUCT_PACK
  967.     #pragma pack()
  968. #endif
  969.  
  970. #ifdef PRAGMA_IMPORT_OFF
  971. #pragma import off
  972. #elif PRAGMA_IMPORT
  973. #pragma import reset
  974. #endif
  975.  
  976. #ifdef __cplusplus
  977. }
  978. #endif
  979.  
  980. #endif /* __INPUTSPROCKET__ */
  981.  
  982.